package us.icitap.cm.business.entities;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import org.eclipse.persistence.annotations.Customizer;

import us.icitap.cm.utils.MyCustomizer;

@Entity
@Customizer(MyCustomizer.class)
@Table(name="OFFICER", schema="MPC")
public class Officer implements Serializable {

	@Id
	@Column(length=15)
	private String policeId;
	
	@Column(name="NAME_SURNAME")
	private String nameSurname;

	private transient OrgStructure orgStructure;
	
	
	public Officer() {
		// TODO Auto-generated constructor stub
	}
	
	public Officer(String policeId, String nameSurname) {
		this.policeId = policeId;
		this.nameSurname = nameSurname;
	}
	
	public String getPoliceId() {
		return policeId;
	}

	public void setPoliceId(String policeId) {
		this.policeId = policeId;
	}

	public String getNameSurname() {
		return nameSurname;
	}

	public void setNameSurname(String nameSurname) {
		this.nameSurname = nameSurname;
	}

	/**
	 * @param orgStructure the orgStructure to set
	 */
	public void setOrgStructure(OrgStructure orgStructure) {
		this.orgStructure = orgStructure;
	}

	/**
	 * @return the orgStructure
	 */
	public OrgStructure getOrgStructure() {
		return orgStructure;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((nameSurname == null) ? 0 : nameSurname.hashCode());
		result = prime * result
				+ ((orgStructure == null) ? 0 : orgStructure.hashCode());
		result = prime * result
				+ ((policeId == null) ? 0 : policeId.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Officer other = (Officer) obj;
		if (nameSurname == null) {
			if (other.nameSurname != null)
				return false;
		} else if (!nameSurname.equals(other.nameSurname))
			return false;
		if (orgStructure == null) {
			if (other.orgStructure != null)
				return false;
		} else if (!orgStructure.equals(other.orgStructure))
			return false;
		if (policeId == null) {
			if (other.policeId != null)
				return false;
		} else if (!policeId.equals(other.policeId))
			return false;
		return true;
	}

	
	


}
